import { request } from "@umijs/max"

const apiHost = 'http://127.0.0.1:8088'

export const postRegister = async (params) => {
  return request(`${apiHost}/users/register`,{
    method:"POST",
    params
  })
}

export const postLogin = async (params) => {
  return request(`${apiHost}/users/login`,{
    method:"POST",
    params
  })
}

export const postUpdateInfo = async (params) => {
  return request(`${apiHost}/my/update_info`,{
    method:"POST",
    // params
    data:{
      ...params
    },
  })
}

export const postUpdatePassword = async (params) => {
  return request(`${apiHost}/my/update_password`,{
    method:"POST",
    // data:{
    //   ...params
    // }
    params
  })
}

export const getMy = async (params) => {
  return request(`${apiHost}/my`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const postAddCommodity = async (params) => {
  return request(`${apiHost}/admin/add_commodity`,{
    method:"POST",
    data:{
      ...params
    }
    // params
  })
}

export const getCommodity = async (params) => {
  return request(`${apiHost}/main/commodity`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const postAdd = async (params) => {
  return request(`${apiHost}/admin/add`,{
    method:"POST",
    data:{
      ...params
    }
    // params
  })
}

export const getMain = async (params) => {
  return request(`${apiHost}/main`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const postMedicalServices = async (params) => {
  return request(`${apiHost}/admin/add_medicalServices`,{
    method:"POST",
    data:{
      ...params
    }
    // params
  })
}

export const getMedicalServices = async (params) => {
  return request(`${apiHost}/main/find_order_medicalServices`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const postDrug = async (params) => {
  return request(`${apiHost}/admin/add_drug`,{
    method:"POST",
    data:{
      ...params
    }
    // params
  })
}

export const getDrug = async (params) => {
  return request(`${apiHost}/main/find_drug`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const postPet = async (params) => {
  return request(`${apiHost}/admin/add_pet`,{
    method:"POST",
    data:{
      ...params
    }
    // params
  })
}

export const getPet = async (params) => {
  return request(`${apiHost}/main/pet`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const postOrder_commodity = async (params) => {
  return request(`${apiHost}/main/order_commodity`,{
    method:"POST",
    data:{
      ...params
    }
    // params
  })
}

export const postOrder_medicalServices = async (params) => {
  return request(`${apiHost}/main/order_medicalServices`,{
    method:"POST",
    data:{
      ...params
    }
    // params
  })
}

export const postOrder_drug = async (params) => {
  return request(`${apiHost}/main/order_drug`,{
    method:"POST",
    data:{
      ...params
    }
    // params
  })
}

export const getPosts = async (params) => {
  return request(`${apiHost}/posts/page`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const postAddPosts = async (params) => {
  return request(`${apiHost}/posts/add_post`,{
    method:"POST",
    data:{
      ...params
    }
    // params
  })
}

export const postAdd_view = async (params) => {
  return request(`${apiHost}/views/add_view`,{
    method:"POST",
    data:{
      ...params
    }
    // params
  })
}

export const getCommodity_order = async (params) => {
  return request(`${apiHost}/my/commodity_order`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const postDelOrder = async (params) => {
  return request(`${apiHost}/my/delOrder`,{
    method:"DELETE",
    // data:{
    //   ...params
    // }
    params
  })
}

export const getMedical_service_order = async (params) => {
  return request(`${apiHost}/my/medical_service_order`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const postDelmedical_service_order = async (params) => {
  return request(`${apiHost}/my/delOrder`,{
    method:"DELETE",
    // data:{
    //   ...params
    // }
    params
  })
}


export const getDrug_order = async (params) => {
  return request(`${apiHost}/my/drug_order`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}


export const deleteGG = async (params) => {
  return request(`${apiHost}/admin/del`,{
    method:"DELETE",
    // data:{
    //   ...params
    // }
    params
  })
}

export const deleteCommodity = async (params) => {
  return request(`${apiHost}/admin/remove_commodity`,{
    method:"DELETE",
    // data:{
    //   ...params
    // }
    params
  })
}


export const updateCommodity = async (params) => {
  return request(`${apiHost}/admin/update_commodity`,{
    method:"Post",
    data:{
      ...params
    }
    // params
  })
}

export const updateMedicalServices = async (params) => {
  return request(`${apiHost}/admin/update_medicalServices`,{
    method:"Post",
    data:{
      ...params
    }
    // params
  })
}

export const deleteMedicalService = async (params) => {
  return request(`${apiHost}/admin/del_medicalService`,{
    method:"DELETE",
    // data:{
    //   ...params
    // }
    params
  })
}

export const updateDrug = async (params) => {
  return request(`${apiHost}/admin/update_drug`,{
    method:"Post",
    data:{
      ...params
    }
    // params
  })
}

export const deleteDrug = async (params) => {
  return request(`${apiHost}/admin/remove_drug`,{
    method:"DELETE",
    // data:{
    //   ...params
    // }
    params
  })
}


// export const getPet = async (params) => {
//   return request(`${apiHost}/main/pet`,{
//     method:"GET",
//     // data:{
//     //   ...params
//     // }
//     params
//   })
// }

export const getPost = async (params) => {
  return request(`${apiHost}/my/post`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const deletePost = async (params) => {
  return request(`${apiHost}/my/post/del_post`,{
    method:"DELETE",
    // data:{
    //   ...params
    // }
    params
  })
}

export const getViews = async (params) => {
  return request(`${apiHost}/views/find_views`,{
    method:"GET",
    // data:{
    //   ...params
    // }
    params
  })
}

export const delPet = async (params) => {
  return request(`${apiHost}/pet/remove_pet`,{
    method:"DELETE",
    // data:{
    //   ...params
    // }
    params
  })
}

export const getView = async (params) => {
  return request(`${apiHost}/my/view`,{
    // data:{
    //   ...params
    // }
    params
  })
}

export const delView = async (params) => {
  return request(`${apiHost}/my/view/del_view`,{
    method:"DELETE",
    // data:{
    //   ...params
    // }
    params
  })
}